<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta charset="utf-8">
<title>部门列表</title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<link rel="stylesheet" type="text/css"
	href="js/lib/bootstrap/css/bootstrap.css">

<link rel="stylesheet" type="text/css" href="css/stylesheets/theme.css">
<link rel="stylesheet" href="js/lib/font-awesome/css/font-awesome.css">

<script src="js/lib/jquery-1.7.2.min.js" type="text/javascript"></script>


<style type="text/css">
#line-chart {
	height: 300px;
	width: 800px;
	margin: 0px auto;
	margin-top: 1em;
}

.brand {
	font-family: georgia, serif;
}

.brand .first {
	color: #ccc;
	font-style: italic;
}

.brand .second {
	color: #fff;
	font-weight: bold;
}
</style>

</head>

<body class="">


	<div class="navbar">
		<div class="navbar-inner">
			<ul class="nav pull-right">

				<li><a href="#"
					class="hidden-phone visible-tablet visible-desktop" role="button">Settings</a></li>
				<li id="fat-menu" class="dropdown"><a href="#" role="button"
					class="dropdown-toggle" data-toggle="dropdown"> <i
						class="icon-user"></i> Jack Smith <i class="icon-caret-down"></i>
				</a>

					<ul class="dropdown-menu">
						<li><a tabindex="-1" href="#">My Account</a></li>
						<li class="divider"></li>
						<li><a tabindex="-1" class="visible-phone" href="#">Settings</a></li>
						<li class="divider visible-phone"></li>
						<li><a tabindex="-1" href="sign-in.html">Logout</a></li>
					</ul></li>

			</ul>
			<a class="brand" href="index.html"><span class="first">Your</span>
				<span class="second">Company</span></a>
		</div>
	</div>




	<div class="sidebar-nav">
		<a href="#dashboard-menu" class="nav-header" data-toggle="collapse"><i
			class="icon-dashboard"></i>欢迎使用</a>
		<ul id="dashboard-menu" class="nav nav-list collapse in">
			<li><a href="<%=basePath%>jsp/index.jsp">主页</a></li>
			<li><a href="<%=basePath%>html/map.jsp">地图</a></li>
		</ul>

		<a href="#accounts-menu" class="nav-header" data-toggle="collapse">
		<i class="icon-github"></i>部门管理<i class="icon-chevron-up"></i></a>
		<ul id="accounts-menu" class="nav nav-list">
			<li><a href="<%=basePath%>department/list">部门列表</a></li>
			<li><a href="<%=basePath%>jsp/add_department.jsp">添加部门</a></li>
		</ul>

		<a href="#error-menu" class="nav-header collapsed"
			data-toggle="collapse"><i class="icon-user"></i>员工管理 <i
			class="icon-chevron-up"></i></a>
		<ul id="error-menu" class="nav nav-list collapse">
			<li><a href="<%=basePath%>employee/list">员工列表</a></li>
			<li><a href="<%=basePath%>employee/department/list">添加员工</a></li>
		</ul>

        <a href="#legal-menu" class="nav-header" data-toggle="collapse"><i class="icon-legal"></i>文件管理</a>
        <ul id="legal-menu" class="nav nav-list collapse">
            <li ><a href="<%=basePath%>jsp/manage_file.jsp">上传文件</a></li>
            <li ><a href="<%=basePath%>file/listFile">文件列表</a></li>
        </ul>

		<a href="help.html" class="nav-header"><i class="icon-question-sign"></i>帮助</a> </div>



	<div class="content">

		<div class="header">

			<h1 class="page-title">部门列表</h1>
		</div>

		<ul class="breadcrumb">
			<li><a href="index.html">主页</a> <span class="divider">/</span></li>
			<li class="active">部门列表</li>
		</ul>

		<div class="container-fluid">
			<div class="row-fluid">

				<div class="btn-toolbar">
					<button class="btn btn-primary"
						onclick="location.href='<%=basePath%>jsp/add_department.jsp'">
						<i class="icon-plus"></i> 添加部门
					</button>
					<!--  <button class="btn">导入数据</button>-->
					<button class="btn" onclick="download()">导出数据</button>
					<div class="btn-group"></div>
				</div>
				<div>
				<form action="<%=basePath%>department/load" method="post">
        		<input type="text" id="dname" name="dname" style="height:26px"/>
        		<input type="submit" name="" class="btn btn-primary" value="查询"/>
        		</form>
				</div>
				<div class="well">
					<table class="table">
						<thead>
							<tr>
								<th>部门编号</th>
								<th>部门名称</th>
								<th>部门描述</th>
								<th style="width: 50px;">编辑</th>
							</tr>
						</thead>
						<tbody>

							<c:forEach items="${list}" var="list">
								<tr>
									<td>${list.did}</td>
									<td>${list.dname}</td>
									<td>${list.ddesc}</td>
									<td><a href="department/toUpdate?did=${list.did}"><i class="icon-pencil"></i></a> 
									<a href="department/delete?did=${list.did}" onclick="return confirm('确认要删除？')"><i class="icon-remove"></i></a>
									</td>
								</tr>
							</c:forEach>

						</tbody>
					</table>
				</div>
				<p style="font-size:16px;color:#2894FF">
					共 <b>${page.totalRecords}</b> 条 当前第<span>${page.pageNo}/${page.totalPages}</span>页
					跳至 <input id="currentPage" name="currentPage" type='text'
						value='${page.pageNo}' class='' style="width: 10px" /> 页 <a
						href="" class='go' onclick="goPage();return false">GO</a>
				</p>
				<div class="pagination">
					<ul>
						<li><a href="department/list?pageNo=${page.topPageNo}">首页</a></li>
						<li><a href="department/list?pageNo=${page.previousPageNo}">上一页</a></li>
						<li><a href="department/list?pageNo=${page.nextPageNo}">下一页</a></li>
						<li><a href="department/list?pageNo=${page.bottomPageNo}">尾页</a></li>
					</ul>
				</div>

				<div class="modal small hide fade" id="myModal" tabindex="-1"
					role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">Ã</button>
						<h3 id="myModalLabel">Delete Confirmation</h3>
					</div>
					<div class="modal-body">
						<p class="error-text">
							<i class="icon-warning-sign modal-icon"></i>Are you sure you want
							to delete the user?
						</p>
					</div>
					<div class="modal-footer">
						<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
						<button class="btn btn-danger" data-dismiss="modal">Delete</button>
					</div>
				</div>



				<footer>
				<hr>

				<!-- Purchase a site license to remove this link from the footer: http://www.portnine.com/bootstrap-themes -->
				<p class="pull-right">
					A <a href="http://www.portnine.com/bootstrap-themes"
						target="_blank">Free Bootstrap Theme</a> by <a
						href="http://www.portnine.com" target="_blank">Portnine</a>
				</p>

				<p>
					&copy; 2012 <a href="http://www.portnine.com" target="_blank">Portnine</a>
				</p>
				</footer>

			</div>
		</div>
	</div>



	<script src="js/lib/bootstrap/js/bootstrap.js"></script>
	<script type="text/javascript">
		$("[rel=tooltip]").tooltip();
		$(function() {
			$('.demo-cancel-click').click(function() {
				return false;
			});
		});

		function download() {
			var url = "department/export";
			window.open(url);
		}
		
	    function goPage(){
	        var currentPage = document.getElementById('currentPage');
	        var totalPages = ${page.totalPages};
	        if(parseInt(currentPage.value)<parseInt(totalPages)&&parseInt(currentPage.value)>=1){
	        var url = "department/list?pageNo="+currentPage.value;
	        window.location.href = url;
	        }else{
	        	alert("不存在该页，请重新输入页数");
	        	return false;
	        }
	      }
	    
	</script>

</body>
</html>


